import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [

  {
      path:'/',
      redirect: '/HomePage',  // 重定向:重新指向其它path,会改变网址
  },

  

  {
    path:'/',
    name:'Main',
    component:()=>import('../components/MainPage.vue'),
    
    children:[
      
      {
        path:'/HomePage',
        name:'HomePage',
        component:()=>import('../page/HomePage.vue'),
        children:[
          {
            path:'/KaFei',
            name:'KaFei',
            component:()=>import('../page/index/KaFei.vue'),
          },
          {
            path:'/JingDian',
            name:'JingDian',
            component:()=>import('../page/index/JingDian.vue'),
          },
        ]
      },
      {
        path:'/ClassPage',
        name:'ClassPage',
        component:()=>import('../page/ClassPage.vue')
      },
      {
        path:'/ShopPage',
        name:'ShopPage',
        component:()=>import('../page/ShopPage.vue')
      },
      {
        path:'/MyPage',
        name:'MyPage',
        component:()=>import('../page/MyPage.vue')
      }
    ]
  },

  {
    path:'/DeletPage/:id',
    name:'DeletPage',
    props:true,
    component:()=>import('../components/DeletPage.vue')
  },
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
